package com.woniu40.petai_user.web;


import com.woniu40.petai_user.service.CoordinatesService;
import com.woniu40.petai_user.service.HospitalService;
import com.woniu40.petai_user.vo.CoordinatesVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

@Controller
public class MapController {

    @Autowired
    CoordinatesService coordinatesService;

    @RequestMapping("/map")
    public String map(Map map){
        List<CoordinatesVo> hospital = coordinatesService.findHospital();
        map.put("hospitalList",hospital);
        return "hospitalView";
    }

    @RequestMapping("/findMap")
    public String findMap(Map map, HttpSession session){
        Integer hospitalId = (Integer) session.getAttribute("hospitalId");
        CoordinatesVo hos = coordinatesService.findHos(hospitalId);
        map.put("hosMap",hos);
        return "hospitalView";
    }






}
